import request from '@/utils/request.js'

//登录
export const userLoginService=(loginData)=>{
    return request.post('/user/userLogin',loginData)
}
export const getAwardNum=()=>{
    return request.get('/award//getAwardNum')
}
//登出
export const userLogOutService=()=>{
    return request.get('/user/userLogout')
}

export const getUserCurrent=()=>{
    return request.get('/user/userCurrent')
}
export const getTableDataApi=(requestData)=>{
    return request.get('/judges/search/works',{
        params:requestData
    })
}
export const getWorkDetailsAPi=(requestId)=>{
    return request.get('/judges/worksDetail',{
        params:requestId
    })
}
export const updateScoreAPi=(
    id,
    workId,
    userId,
    scoreVO,
    comments)=>{
    return request.post('/judges/updateScore',{
        id,
        workId,
        userId,
        scoreVO,
        comments
    })
}
export const SaveWorksAPi=(saveData)=>{
    return request.post('/teacher/worksSave',saveData)
}

export const uploadFiles=(formData,config)=>{
    return request.put('/upload/file',formData,config)
}
export const updateWorks=(id)=>{
    return request.post('/teacher/update',{id})
}

export const submitWorksAPi= (saveData)=>{
    return request.post('/teacher/worksSubmit',saveData)
}
export const getWorksAPi= ()=>{
    return request.get('/teacher/getWorks')
}

export const getAwardsAPi= ()=>{
    return request.get('/award/getAwardInfo')
}


/** 
 * 修改密码
 * @param {object} params userUpdatePassword
 * @param {string} params.newPassword 
 * @param {string} params.newPasswordConf 
 * @param {string} params.oldPassword 
 * @returns
 */
export function updatePassword(params) {
    return request.post(`/user/updatePassword`, params);
  }